<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	response.setHeader("Pragma", "No-cache");
	response.setHeader("Cache-Control", "no-cache");
	response.setDateHeader("Expires", 0);
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
	<head lang="en">
	    <meta charset="UTF-8">
	    <title>职位编辑</title>
		<jsp:include page="../common/top.jsp"></jsp:include>
		<script type="text/javascript" src="${path }/ueditor/ueditor.config.js"></script>
		<script type="text/javascript" src="${path }/ueditor/ueditor.all.js"></script>
		
  	</head>
	<body class="page-content ">
		<div class="page-content-area" data-ajax-content="true">
			<div class="page-header">
				<h1>职位编辑</h1>
			</div>
			<div class="row">
				<div class="col-xs-12">
					<form id="_editForm" class="form-horizontal" role="form" validate="true" method="post" enctype="multipart/form-data">
						<input type="hidden" name="id" value="${bean.id }"/> 
						
						
						

							
						<div class="form-group">
							<label class="col-sm-3 control-label no-padding-right">职位名称</label>
							<div class="col-sm-9">
								<div class="clearfix help-validate">
									<input type="text" name="professionName" value="${bean.profession}" placeholder="职位名称" class="col-xs-10 col-sm-5">
									<li style="color: red;">必填</li>
								</div>
							</div>
						</div>
						
						<div class="clearfix form-actions">
							<div class="col-md-offset-3 col-md-9">
								<button id="_submit" class="btn btn-info" type="button" data-loading-text="正在提交..." permission="/maintainRights/save">
									<i class="ace-icon fa fa-check bigger-110"></i>
									提交
								</button>
							</div>
						</div>
						
					</form>
				</div>
			</div>
		</div>
		<jsp:include page="../common/bottom.jsp"></jsp:include>
		<script type="text/javascript">
			jQuery(function($) {
				
				$("#type").change(function(){
					catalogType();
				});
				// 提交
				$("#_submit").click(function(){
					if($('#_editForm').validate()){
						var btn = $(this);
						btn.button('loading');
						$.post("${path}/admin/profession/save", $.formJson('_editForm'),function(d) {
							if(d){
								btn.button('reset');
								if(d.status == '0000'){
									$('input[name="id"]').val(d.data.id);
									window.location.href = '${path}/admin/profession';
								}else {
									$.gritter.add({text: d.message});
								}
							}
				        },'json');
					}
				});
				
				function catalogType(){
					if($("#type").val() == 0){
						$("#parentId").hide();
						$("#content").hide();
					}else if($("#type").val() == 1){
						$("#parentId").show();
						$("#content").hide();
					}else if($("#type").val() == 2){
						$("#parentId").hide();
						$("#content").show();
					}else if($("#type").val() == 3){
						$("#parentId").hide();
						$("#content").hide();
					}
				}
			});
		</script>
		
		<script type="text/javascript">
		  var ue = UE.getEditor('container');
	   
	   </script>
	</body>
</html>

